package com.ruoyi.project.insurance.contract.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.service.DictService;
import com.ruoyi.project.insurance.contract.domain.Contract;
import com.ruoyi.project.insurance.contract.service.IContractService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description: 问题件修改
 * @create 2022/2/1011:09
 */
@Controller
@RequestMapping("insurance/modify")
public class ModifyController extends BaseController {
    private String prefix = "insurance/contract";

    @Autowired
    private IContractService contractService;
    @Autowired
    private DictService dictService;

    @RequiresPermissions("insurance:modify:view")
    @GetMapping()
    public String contract()
    {
        return prefix + "/modify";
    }

    /**
     * 查询contract列表
     */
    @RequiresPermissions("insurance:modify:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(Contract contract)
    {
        startPage();
        List<Contract> list = contractService.selectContractList(contract);
        return getDataTable(list);
    }
    /**
     * 复核
     */
    @GetMapping("/edit/{id}")
    public String check(@PathVariable("id") String id, ModelMap mmap)
    {
        Contract contract = contractService.selectContractById(id);
        mmap.put("contract", contract);
        return prefix + "/edit";
    }
}
